package onlineLanguageQuiz

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method("PUT")
        url("/api/v3/onlineLanguageQuizzes/1")
        headers {
            contentType(applicationJsonUtf8())
            header("id", 21)
        }
        body("""
            {
                "language":"language",
                "title":"title",
                "description":"description",
                "testData":"testData",
                "initCode":"initCode",
                "answer":"answer",
                "answerDescription":"answerDescription",
                "stackId":1,
                "tags":["java","node"],
                "remark":"remark",
                "quizGroupId": 1
            }
        """)
        bodyMatchers {
            jsonPath('$.language', byRegex("[\\s\\S]+"))
            jsonPath('$.title', byRegex("[\\s\\S]+"))
            jsonPath('$.description', byRegex("[\\s\\S]+"))
            jsonPath('$.testData', byRegex("[\\s\\S]+"))
            jsonPath('$.initCode', byRegex("[\\s\\S]+"))
            jsonPath('$.answer', byRegex("[\\s\\S]+"))
            jsonPath('$.answerDescription', byRegex("[\\s\\S]+"))
            jsonPath('$.stackId', byRegex(number()))
            jsonPath('$.tags', byRegex("[\\s\\S]+"))
            jsonPath('$.remark', byRegex("[\\s\\S]+"))
            jsonPath('$.quizGroupId', byRegex(number()))
        }
    }
    response {
        status(204)
    }
}
